<template>
  <div class="mui-pages">
    <header class="mui-bar mui-bar-nav">
      <div class="header-common-title flex-justify-start">
        <div @click="fn.back()" class="mui-action-back"><img class="back-btn" src="../../../../static/images/back.png"></div>
        <div class="header-search flex-center">党员答题情况</div>
        <div class="header-right flex-center answer-card" @click="goApplyRecord">
          <img src="../../../../static/images/zhuzhi_jiegou.png" alt="">申请记录</div>
      </div>
    </header>
    <div class="mui-page-content">
      <div class="mui-scroll-wrapper">
        <div class="mui-scroll">
          <div class="statistics-header">
            <h4>学习主题：{{answerSituationItem.subject}}</h4>
            <p class="record-lists work-message-item-worlds">答题时间：{{answerSituationItem.studyBeginTime}}至{{answerSituationItem.studyEndTime}}</p>
          </div>
          <ul class="message-details people-lists">
            <li class="flex-between-center" v-for="item in list">
              <div class="flex-justify-start">
                <div class="people-lists-touxiang"></div>
                <p>{{item.partyMemberName}}</p>
              </div>
              <h5 v-if="item.score > 0.0 && !item.requestNoAnswer">已答题</h5>
              <h5 v-if="(item.score === 0.0 && !item.requestNoAnswer) || (item.requestNoAnswer && item.requestNoAnswerResult==='0')" class="flex-between-center">
                <span class="mine-lists-money lists-input">未答题</span>
                <div @click="go(item)" class="red-btn">未答说明</div></h5>
              <h5 v-if="item.requestNoAnswer && item.requestNoAnswerResult==='1'">未答题(特殊情况)</h5>
              <h5 v-if="item.requestNoAnswer && !item.requestNoAnswerResult" class="flex-between-center">
                <span class="mine-lists-money lists-input">未答题</span>
                <div class="unselect-btn">申请中</div></h5>
            </li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import tools from '@/utils/tools'
  import loginService from '@/service/loginService'
  export default {
    name: 'answerSituation',
    data () {
      return {
        fn: tools,
        isLoading: true,
        list: [],
        answerSituationItem: {}
      }
    },
    created () {
      this.answerSituationItem = this.$store.state.answerSituationItem
      this.loadData()
    },
    methods: {
      loadData () {
        let userInfo = this.$store.state.userInfo
        let partyGroupId = userInfo.partyMemberModel.partyGroupId
        let data = {
          partyGroupId: partyGroupId,
          weekPlanId: this.answerSituationItem.weekPlanId
        }
        this.isLoading = true
        loginService.getPartyMemberAnswer(data).then(res => {
          this.isLoading = false
          if (res.code !== 200) {
            return tools.tip(res.message)
          }
          this.list = res.data
        })
      },
      go (item) {
        // 保存此条信息
        item.weekPlanId = this.answerSituationItem.weekPlanId
        this.$store.state.answerExplainItem = item
        console.log("item=", item)
        this.$router.push({path: '/answerExplain'})
      },
      goApplyRecord () {
        this.$router.push({path: '/applyRecord'})
      }
    }
  }
</script>
<style scoped>

</style>
